home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_tem_boulderdash.cog < prev    next >
Text File  |  1999-11-15  |  14KB  |  469 lines

  1. # Jones 3D Cog Script
  2. #
  3. # TEM_BoulderDash.cog
  4. #
  5. # [TRM]
  6. #
  7. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  8. # ========================================================================================
  9.  
  10. symbols
  11.  
  12.     message     startup
  13.     message     entered
  14.     message     pulse
  15.     
  16.     # ** local things **
  17.     thing       player                  local
  18.     thing       indy                    local
  19.     thing       victim                  local
  20.     thing       boulder_1               local
  21.     thing       boulder_2               local
  22.     thing       boulder_3               local
  23.     thing       boulder_4               local
  24.     thing       staticBoulder_1         local
  25.     thing       staticBoulder_2         local
  26.     thing       staticBoulder_3         local
  27.     
  28.     # ** boulder positions **
  29.     thing       boulder_ghost1
  30.     thing       boulder_ghost2
  31.     thing       boulder_ghost3
  32.     thing       boulder_ghost4
  33.     
  34.     # ** cameras **
  35.     thing       cam1
  36.     
  37.     # ** **
  38.     thing       lookTarg
  39.     thing       walkTarg
  40.     
  41.     # ** player surface triggers **
  42.     surface     trig_Ledge0
  43.     surface     trig_Ledge1
  44.     surface     trig_Ledge2
  45.     surface     trig_Ledge3
  46.     
  47.     # ** boulder surface triggers **
  48.     surface     trig_stopB1             mask=0x004
  49.     surface     trig_B2_1               mask=0x004      # make surf_Gap1 no move
  50.     surface     trig_B3_1               mask=0x004      # make surf_Gap2 no move
  51.     
  52.     # ** gap surfaces between jumps **
  53.     surface     surf_Gap0               mask=0x004
  54.     surface     surf_Gap1               mask=0x004
  55.     surface     surf_Gap2               mask=0x004
  56.     
  57.     # ** misc surfaces **
  58.     surface     doorway                 # make this no move
  59.     
  60.     # ** keyframes **
  61.     keyframe    key_Roll=gen_boulder.key        local
  62.     keyframe    in_Smashed=in_die_fall.key      local
  63.     keyframe    smashed=in_die_fall.key         local
  64.     
  65.     # ** templates **
  66.     template    staticBoulder=nicebould         local
  67.     template    rollingBoulder=boulder_mc       local
  68.     template    tpl_Explosion=+bazooka_exp      local
  69.     template    tpl_Indy=indy_sh_actor          local
  70.  
  71.     # ** sound fx **
  72.     sound       sfxCrash=gen_grenade_explode.wav            local   # bang2
  73.     sound       sndQuake=pru_boulder_rolling_c.wav          local   # boulder roll
  74.     sound       sndBoulder=olv_rockhead_roll_c.wav          local   # boulder roll better
  75.     sound       sndStop=pru_boulder_crash_c.wav             local   # boulder stop
  76.     sound       sndDie=tem_temspikes_up_kill_c.wav          local   # squish
  77.     
  78.     # ** voice lines **
  79.     sound       in_WrongHere=Inxj042.wav                    local   # something's wrong here.
  80.     
  81.     # ** music **
  82.     sound       mus_Danger=mus_gen_danger3.wav          local
  83.     sound       mus_Relief=mus_gen_indyrelief.wav       local
  84.     
  85.     cog         cameraShake
  86.     
  87.     vector      b2_Distance         local
  88.     vector      b3_Distance         local
  89.     
  90.     flex        minDistance=0.2   local
  91.     
  92.     # ** ints **
  93.     int         b2_Rolling=0    local
  94.     int         b3_Rolling=0    local
  95.     int         doorBlocked=0   local
  96.     int         side=0          local
  97.     int         triggeredB2=0   local
  98.     int         triggeredB3=0   local
  99.     int         floorDrop0=0    local
  100.     int         b2=0            local
  101.     int         b3=0            local
  102.     int         done=0          local
  103.     
  104.     int         sound1          local
  105.     int         roll            local
  106.     int         numSides=4      local
  107.     int         dif_Level       local
  108.     
  109. end
  110.  
  111. # ========================================================================================
  112.  
  113. code
  114.  
  115. startup:
  116.  
  117.     player = GetLocalPlayerThing();
  118.     
  119.     # create static boulders
  120.     staticBoulder_1 = CreateThing(staticBoulder, boulder_ghost1);
  121.     CaptureThing(staticBoulder_1);
  122.     staticBoulder_2 = CreateThing(staticBoulder, boulder_ghost2);
  123.     CaptureThing(staticBoulder_2);
  124.     staticBoulder_3 = CreateThing(staticBoulder, boulder_ghost3);
  125.     CaptureThing(staticBoulder_3);
  126.     
  127.     SetThingLight(staticBoulder_1, '0.35 0.35 0.35', 0.001, 0.1);
  128.     SetThingLight(staticBoulder_2, '0.35 0.35 0.35', 0.001, 0.1);
  129.     SetThingLight(staticBoulder_3, '0.35 0.35 0.35', 0.001, 0.1);
  130.     
  131.     return;
  132.     
  133. # ========================================================================================
  134.  
  135. entered:
  136.     
  137.     dif_Level = GetDifficulty();
  138.     
  139. # *********************
  140. # ** player triggers **
  141. # *********************
  142.     if((GetSenderRef() == trig_Ledge0) && (doorBlocked == 0))
  143.     {
  144.         doorBlocked = 1;
  145.         
  146.         # do cutscene stuff
  147.         MakeMeStop();
  148.         StartCutscene(0);
  149.         
  150.         # create indy actor
  151.         indy = CreateThing(tpl_Indy, player);
  152.         CaptureThing(indy);
  153.         
  154.         # outfit indy actor
  155.         CopyPlayerHolsters(player, indy);
  156.         
  157.         # hide player show indy
  158.         SetThingFlags(player, 0x80000);
  159.         ClearThingFlags(indy, 0x80000);
  160.         
  161.         # switch cam
  162.         SetCameraFocus(2, cam1);
  163.         SetCameraSecondaryFocus(2, player);
  164.         SetCurrentCamera(2);
  165.         SetCameraFOV(90, 0, 0.0);
  166.         
  167.         # walk actor to edge
  168.         AISetMoveSpeed(indy, 1.2);
  169.         AISetLookThing(indy, lookTarg);
  170.         AISetMoveThing(indy, walkTarg, 0);
  171.         
  172.         # play danger music cue
  173.         PlaySoundLocal(mus_Danger, 1.0, 0.0, 0x0, 0);
  174.         
  175.         # destroy static, create rolling
  176.         DestroyThing(staticBoulder_1);
  177.         boulder_1 = CreateThing(rollingBoulder, boulder_ghost1);
  178.         CaptureThing(boulder_1);
  179.         
  180.         SetThingLight(boulder_1, '0.35 0.35 0.35', 0.001, 0.1);
  181.         
  182.         # block the way back with boulder_1
  183.         SetThingThrust(boulder_1, '0.0 1.5 0.0');
  184.         roll = PlayKey(boulder_1, key_Roll, 4, 0x0, 0);
  185.         sound1 = PlaySoundThing(sndBoulder, boulder_1, 1.0, 15.0, 25.0, 0x81);
  186.         ClearAdjoinFlags(doorway, 2);         # no move
  187.     }
  188.     
  189.     # 4m jump to first ledge: roll boulder_2
  190.     else if((GetSenderRef() == trig_Ledge1) && (b2_Rolling == 0))
  191.     {
  192.         b2_Rolling = 1;
  193.         b2 = 1;
  194.         
  195.         SetExtCamOffset('0.0 -0.4 0.4');
  196.         
  197.         # start camera shake
  198.         #SendMessage(cameraShake, user0);
  199.         
  200.         # start proximity pulse
  201.         SetPulse(0.25);
  202.  
  203.         # destroy static, create rolling
  204.         DestroyThing(staticBoulder_2);
  205.         boulder_2 = CreateThing(rollingBoulder, boulder_ghost2);
  206.         CaptureThing(boulder_2);
  207.         
  208.         #SetCollideType(boulder_2, 0);
  209.         
  210.         SetThingLight(boulder_2, '0.35 0.35 0.35', 0.001, 0.1);
  211.             
  212.         # get the ball rolling
  213.         SetThingThrust(boulder_2, '0.0 1.0 0.0');
  214.         roll = PlayKey(boulder_2, key_Roll, 4, 0x0, 0);
  215.         sound1 = PlaySoundThing(sndBoulder, boulder_2, 1.0, 10.0, 20.0, 0x81);
  216.         
  217.         Sleep(2.0);
  218.         
  219.         # stop camera shake
  220.         #SendMessage(cameraShake, user1);
  221.     }
  222.     
  223.     # 6m jump and grab to second ledge: roll boulder_3
  224.     else if((GetSenderRef() == trig_Ledge2) && (b3_Rolling == 0))
  225.     {
  226.         b3_Rolling = 1;
  227.         b3 = 1;
  228.         
  229.         SetExtCamOffset('0.0 -0.4 0.4');
  230.         
  231.         if(dif_Level < 3)
  232.         {
  233.             # give player time to climb up
  234.             Sleep(1.0);
  235.         }
  236.         
  237.         # start camera shake
  238.         #SendMessage(cameraShake, user0);
  239.         
  240.         # destroy static, create rolling
  241.         DestroyThing(staticBoulder_3);
  242.         boulder_3 = CreateThing(rollingBoulder, boulder_ghost3);
  243.         CaptureThing(boulder_3);
  244.         
  245.         #SetCollideType(boulder_3, 0);
  246.         
  247.         SetThingLight(boulder_3, '0.35 0.35 0.35', 0.001, 0.1);
  248.             
  249.         # get the ball rolling
  250.         SetThingThrust(boulder_3, '0.0 1.0 0.0');
  251.         roll = PlayKey(boulder_3, key_Roll, 4, 0x0, 0);
  252.         sound1 = PlaySoundThing(sndBoulder, boulder_3, 1.0, 10.0, 20.0, 0x81);
  253.         
  254.         # start proximity pulse
  255.         SetPulse(0.25);
  256.         
  257.         Sleep(2.0);
  258.         
  259.         # stop camera shake
  260.         #SendMessage(cameraShake, user1);
  261.     }
  262.     
  263.     # 6m jump and grab to safety ledge
  264.     else if((GetSenderRef() == trig_Ledge3) && (done == 0))
  265.     {
  266.         done = 1;
  267.         
  268.         restoreExtCam();
  269.         
  270.         UpdateDifficulty(dif_Level);
  271.         
  272.         # play relief music cue
  273.         PlaySoundLocal(mus_Relief, 1.0, 0.0, 0x0, 0);
  274.     }
  275.     
  276. # **********************
  277. # ** boulder triggers **
  278. # **********************
  279.     # stop boulder_1 and create static boulder to block doorway
  280.     else if(GetSenderRef() == trig_stopB1)
  281.     {
  282.         # stop the boulder
  283.         StopThing(boulder_1);
  284.         #StopKey(boulder_1, roll, 0.0);
  285.         
  286.         # deal with sfx stuff
  287.         PlaySoundThing(sndStop, boulder_1, 1.0, 15.0, 25.0, 0x0);
  288.         StopSound(sound1, 1.0);
  289.         
  290.         # destroy boulder_1 and create static boulder
  291.         DestroyThing(boulder_1);
  292.         boulder_4 = CreateThing(staticBoulder, boulder_ghost4);
  293.         CaptureThing(boulder_4);
  294.         
  295.         SetThingLight(boulder_4, '0.35 0.35 0.35', 0.001, 0.1);
  296.         
  297.         # indy looks at boulder
  298.         AISetLookThing(indy, boulder_ghost4);
  299.         
  300.         # say something's wrong here
  301.         Sleep(1.0);
  302.         PlayVoice(player, in_WrongHere, 1.0, 1);
  303.         
  304.         Sleep(0.5);
  305.         
  306.         # indy looks back at lookTarg
  307.         SetThingMaxRotVel(indy, 190.0);
  308.         AISetLookThing(indy, lookTarg);
  309.         
  310.         Sleep(1.0);
  311.         
  312.         # stop any unfinished animations
  313.         ResetThing(player);
  314.         
  315.         # Get the player into position
  316.         CopyOrientAndPos(indy, player);
  317.         
  318.         # hide actor show player
  319.         SetThingFlags(indy, 0x80000);
  320.         ClearThingFlags(player, 0x80000);
  321.             
  322.         SetCurrentCamera(1);
  323.         
  324.         # restore player controls
  325.         ClearActorFlags(player, 0x200000);
  326.         EndCutscene();
  327.         
  328.         # recheck difficutly level
  329.         UpdateDifficulty();
  330.     }
  331.     
  332.     # make surf_Gap1 no move after player has gone across
  333.     else if((GetSenderRef() == trig_B2_1) && (triggeredB2 == 0))
  334.     {
  335.         #Print("trig_b2_1");
  336.         triggeredB2 = 1;
  337.         ClearAdjoinFlags(surf_Gap1, 2);         # no move
  338.         ClearAdjoinFlags(surf_Gap0, 2);         # no move
  339.         
  340.         Sleep(1.0);
  341.         
  342.         # alter track
  343.         ClearSurfaceFlags(surf_Gap1, 0x4000);       # no longer track
  344.         SetAdjoinFlags(surf_Gap1, 2);               # boulder can move thru
  345.         SetAdjoinFlags(surf_Gap0, 2);               # boulder can move thru
  346.         
  347.         # detach boulder_2 and stop rolling sound
  348.         DetachThing(boulder_2);
  349.         StopSound(sound1, 1.0);
  350.         
  351.         Sleep(1.5);
  352.         
  353.         # create explosion and destroy boulder_2
  354.         CreateThing(tpl_Explosion, boulder_2);
  355.         Sleep(0.01);
  356.         #StopKey(boulder_2, roll, 0.0);
  357.         DestroyThing(boulder_2);
  358.         
  359.         b2 = 0;
  360.         
  361.         # stop proximity pulse
  362.         #SetPulse(0.0);
  363.     }
  364.         
  365.     # make surf_Gap2 no move after player has gone across
  366.     else if((GetSenderRef() == trig_B3_1) && (triggeredB3 == 0))
  367.     {
  368.         #Print("trig_B3_1");
  369.         triggeredB3 = 1;
  370.         ClearAdjoinFlags(surf_Gap2, 2);         # no move
  371.         
  372.         Sleep(1.0);
  373.         
  374.         # alter track
  375.         ClearSurfaceFlags(surf_Gap2, 0x4000);       # no longer track
  376.         SetAdjoinFlags(surf_Gap2, 2);               # boulder can move thru
  377.         
  378.         # detach boulder_3 and stop rolling sound
  379.         DetachThing(boulder_3);
  380.         StopSound(sound1, 1.0);
  381.         
  382.         Sleep(1.0);
  383.         
  384.         # create explosion and destroy boulder_3
  385.         CreateThing(tpl_Explosion, boulder_3);
  386.         Sleep(0.01);
  387.         StopKey(boulder_3, roll, 0.0);
  388.         DestroyThing(boulder_3);
  389.         
  390.         b3 = 0;
  391.         
  392.         # stop proximity pulse
  393.         SetPulse(0.0);
  394.     }
  395.         
  396.     return;
  397.  
  398. # ========================================================================================
  399.  
  400. pulse:
  401.     
  402.     # get distance from player to center of boulder
  403.     b2_Distance = VectorDist(GetThingPos(player), GetThingPos(boulder_2));
  404.     b3_Distance = VectorDist(GetThingPos(player), GetThingPos(boulder_3));
  405.         
  406.     if(b2 == 1)
  407.     {
  408.         # if boulder center gets within minDistance of player, crush him!
  409.         if(b2_Distance < 0.3)
  410.         {
  411.             if(GetMoveStatus(player) != 15)
  412.             {
  413.                 SetCollideType(boulder_2, 0);
  414.                 
  415.                 RestoreExtCam();
  416.                 
  417.                 # kill player and play keyframe
  418.                 DamageThing(player, 1000.0, 0x1, victim);
  419.                 Sleep(0.1);
  420.                 
  421.                 PlayKey(player, smashed, 10, 0x14, 0);
  422.                 
  423.                 # play squished sfx
  424.                 PlaySoundLocal(sndDie, 1.0, 0.0, 0x0, 0);
  425.                 
  426.                 # stop proximity pulse
  427.                 SetPulse(0.0);
  428.             }
  429.         }
  430.     }
  431.     
  432.     else if(b3 == 1)
  433.     {
  434.         # if boulder center gets within minDistance of player, crush him!
  435.         if(b3_Distance < minDistance)
  436.         {
  437.             if(GetMoveStatus(player) != 15)
  438.             {
  439.                 SetCollideType(boulder_3, 0);
  440.                 
  441.                 RestoreExtCam();
  442.                 
  443.                 # kill player and play keyframe
  444.                 DamageThing(player, 1000.0, 0x1, victim);
  445.                 Sleep(0.1);
  446.                 
  447.                 PlayKey(player, smashed, 10, 0x14, 0);
  448.                 
  449.                 # play squished sfx
  450.                 PlaySoundLocal(sndDie, 1.0, 0.0, 0x0, 0);
  451.                 
  452.                 # stop proximity pulse
  453.                 SetPulse(0.0);
  454.             }
  455.         }
  456.     }
  457.  
  458.     else
  459.     {
  460.         Print("safe distance");
  461.     }
  462.     
  463.     return;
  464.  
  465. # ========================================================================================
  466.  
  467. end
  468.  
  469.